import os
import sys

dir = sys.argv[1]
dir_path = os.path.abspath(dir)
files = os.listdir(dir_path)
bash_files = [os.path.join(dir,fname.replace(".py", ".sh")) \
                for fname in files if ("FS100_BS32.sh") in fname]
with open("launch.sh", 'w') as fw:
    for fname in bash_files:
        cmd_line = f"sbatch {fname}\n"
        fw.write(cmd_line)